<?php

namespace app\zhongcan\Validate;

use think\Validate;

class NewsValidate extends Validate
{
    protected $rule = [
        'title' => 'require|max:30|min:1',
        'image' => 'require',
        'author' => 'require',
        'abstract' => 'require',
        'content' => 'require',
        'look_num' => 'require|integer|number',
    ];
    protected $message = [
        'title.require' =>'标题不能为空',
        'title.max' =>'标题最多可输入30个字符',
        'title.min' =>'标题最少输入1个字符',
        'image.require' =>'封面图片不能为空',
        'author.require' =>'作者不能为空',
        'abstract.require' =>'摘要不能为空',
        'content.require' =>'内容不能为空',
        'look_num.require' =>'浏览量不能为空',
        'look_num.integer' =>'浏览量是整形',
    ];
    protected $scene =[
        'add' =>['title','image','author','abstract','content','look_num'],
        'edit' =>['title','image','author','abstract','content','look_num'],
    ];
}
